FROM cm2network/steamcmd:latest

LABEL maintainer="hamflx <a@hamflx.cn>"

VOLUME "/home/steam/save"
VOLUME "/home/steam/mods"

USER root

RUN set -x \
    && echo >/etc/apt/sources.list \
    && echo 'deb https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free' >>/etc/apt/sources.list \
    && echo 'deb-src https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free' >>/etc/apt/sources.list \
    && echo 'deb https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free' >>/etc/apt/sources.list \
    && echo 'deb-src https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free' >>/etc/apt/sources.list \
    && echo 'deb https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free' >>/etc/apt/sources.list \
    && echo 'deb-src https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free' >>/etc/apt/sources.list \
    && dpkg --add-architecture i386 \
    && apt-get update \
    && apt-get install -y libcurl3-gnutls:i386
RUN su steam -c '/home/steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/steam/dst +app_update 343050 validate +quit'
RUN mkfifo -m 600 "/var/run/dstcommand"
RUN chown steam.steam /var/run/dstcommand

USER steam

COPY ["entrypoint.sh", "/tmp/entrypoint.sh"]

ENTRYPOINT ["/bin/bash", "/tmp/entrypoint.sh"]
